<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0px;
        }
        
        .box {
            height: 50px;
            line-height: 50px;
            width: 50px;
            background-color: red;
            text-align: center;
            position: fixed;
            right: 0px;
        }
        
        .son {
            height: 50px;
            width: 100px;
            text-align: center;
            line-height: 50px;
            background-color: blue;
            position: absolute;
            top: 0px;
            left: 50px;
        }
    </style>
</head>

<body>
    <div class="box">
        <span>></span>
        <div class="son">动画函数</div>
    </div>
</body>
<script src="./animation.js"></script>
<script>
    var box = document.querySelector('.box');
    var son = document.querySelector('.son');
    box.addEventListener('mouseenter', function() {
        animation(son, -100, function() {
            box.children[0].innerHTML = '<'
        });
    })
    box.addEventListener('mouseleave', function() {
        animation(son, 50, function() {
            box.children[0].innerHTML = '>'
        });
    })
</script>

</html>